package com.gupao.zigong.singleton.container;

/**
 * @author zigong
 * @description 测试类
 * @date 2020/9/17 21:11
 */
public class ContainerSingletonTest {
    public static void main(String[] args) {
        // 通过多线程获取实例, 以确定是否是线程安全的
        for (int i = 0; i < 10; i++) {
            new Thread(() -> {
                Object bean = ContainerSingletonThreadSafe.getBean(Person.class.getName());
                System.out.println(Thread.currentThread().getName() + ": " + bean);
            }).start();
        }
    }
}
